﻿namespace AiQiuQuan.Sport.Model.Models
{
    /// <summary>
    /// 分页请求
    /// </summary>
    public class PageRequest
    {
        /// <summary>
        /// 页码
        /// </summary>
        public int PageIndex { get; set; } = 1;

        /// <summary>
        /// 页大小
        /// </summary>
        public int PageSize { get; set; } = 10;
    }

    /// <summary>
    /// 分页结果
    /// </summary>
    public class PageResult
    {
        /// <summary>
        /// 总数
        /// </summary>
        public int Total { get; set; }

        /// <summary>
        /// 空数据
        /// </summary>
        /// <typeparam name="TModel">返回数据模型</typeparam>
        public static PageResult<TModel> Empty<TModel>()
        {
            return new PageResult<TModel> { Result = new List<TModel>() };
        }

        /// <summary>
        /// 分页数据
        /// </summary>
        public static PageResult<TModel> List<TModel>(int total, IList<TModel> list)
        {
            return new PageResult<TModel> { Total = total, Result = list };
        }
    }

    /// <summary>
    /// 分页结果
    /// </summary>
    public class PageResult<TModel> : PageResult
    {
        /// <summary>
        /// 列表数据
        /// </summary>
        public IList<TModel> Result { get; set; }
    }
}
